home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).zip
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).adf
/
tracker.library
/
Demos
/
Exec-Signals.asm
< prev
next >
Wrap
Assembly Source File
|
1994-04-16
|
4KB
|
146 lines
;TestProgramm für "tracker.library"
; Testet TRK_AllocSignal und TRK_FreeSignal
NOLIST
INCLUDE "exec/LVO.i"
INCLUDE "dos/LVO.i"
INCLUDE "dos/dosextens.i"
INCLUDE "libraries/tracker.i"
LIST
_TrackerBase: EQUR a5
_DOSBase: EQUR a4
Output: EQUR d7
; WB-Message ?
sub.l a1,a1 ;a1=0->eigener Task
CALLEXEC FindTask ;Wo darf man denn nachschauen ?
move.l d0,a0
tst.l pr_CLI(a0) ;von CLI oder WB aus gestartet ?
bne fromCLI
;von WB aus:
lea pr_MsgPort(a0),a0
move.l a0,-(sp)
CALLEXEC WaitPort ;auf Start-Message warten
move.l (sp)+,a0
CALLEXEC GetMsg ;muß nachher beantwortet werden
move.l d0,WBenchMsg
fromCLI:
; Tracker-Library öffnen
OPENLIB TrName
tst.l d0
beq ende_all
move.l d0,_TrackerBase
TRK_OPENSTDLIB DOS,36
tst.l d0
beq ende_trk
move.l d0,_DOSBase
tst.l WBenchMsg
bne fromWB
;von CLI aus -> Ausgaben ins CLI-Fenster
CALLDOS Output
move.l d0,Output
bra main
;von WB aus gestartet -> eigenes Window nötig
fromWB: move.l #WdName,d1
move.l #MODE_OLDFILE,d2
CALLDOS Open
move.l d0,Output
;---------------------------------------------------------------------------
;Haupt-Testteil
ALLOC: MACRO ;Nummer, sichern in
move.l #\1,d0
bsr Alloc
move.l d0,\2
ENDM
FREE: MACRO ;wo gesichert
move.l \1,d0
bsr Free
ENDM
main: ALLOC 20,d6
ALLOC -1,d5
ALLOC -1,d5
ALLOC -1,d4
ALLOC 12,d4
ALLOC -1,d4
ALLOC -1,d4
FREE d5
ALLOC -1,d6
FREE d4
;---------------------------------------------------------------------------
;ggf. Window schließen
tst.l WBenchMsg
beq ende_trk
move.l Output,d1
move.l #GoodBye,d2
move.l #GoodByeLen,d3 ;jetzt sind die Speicher-Pointer uninteressant
CALLDOS Write
move.l #150,d1
CALL Delay
move.l Output,d1
CALL Close
;Library schließen
ende_trk:
CLOSELIB _TrackerBase
ende_all:
tst.l WBenchMsg ;war da was ?
beq toCLI ;na dann halt nicht
;Message zur WB zurück
move.l WBenchMsg,a1
CALLEXEC ReplyMsg
toCLI: moveq #0,d0
rts
;---------------------------------------------------------------------------
;Unterroutine: TRK_AllocSignal testen
;Parameter: d0 = Größe des gewünschten Speicherbereichs
; d1 = Anforderungen an den gewünschten Speicherbereich
;Ergebnis: Adresse des allozierten Speichers / 0 bei Fehler
Alloc: move.l d0,-(sp)
CALLTRK TRK_AllocSignal
move.l d0,-(sp)
move.l Output,d1
move.l #AllocText,d2
move.l sp,d3
CALLDOS VFPrintf
move.l (sp)+,d0
add.w #4,sp
rts
;---------------------------------------------------------------------------
;Unterroutine: TRK_FreeSignal testen
;Parameter: a1 = Adresse des Speicherbereichs
;Ergebnis: -
Free: cmp.l #-1,d0
bne 1$
rts
1$: move.l d0,-(sp)
CALLTRK TRK_FreeSignal
move.l Output,d1
move.l #FreeText,d2
move.l sp,d3
CALLDOS VFPrintf
add.w #4,sp
rts
;---------------------------------------------------------------------------
WBenchMsg: dc.l 0
TrName: TRACKERNAME
AllocText: dc.b "Signal #%ld allocated [#%ld requested]",10,0
FreeText: dc.b "Signal #%ld freed",10,0
WdName: dc.b "CON:////AllocSignal-Test für tracker.library",0
GoodBye: dc.b 10,"Bye - closing soon !"
GoodByeLen: equ *-GoodBye
END